package ;
import nme.display.Sprite;
import nme.events.Event;

/**
 * ...
 * @author liwei
 */

class MyPerloader extends NMEPreloader
{

	public function new() 
	{
		super();
		removeChild(this.outline);
		removeChild(this.progress);
	}
	override public function onUpdate(bytesLoaded:Int, bytesTotal:Int):Dynamic 
	{
		var percentLoaded = bytesLoaded / bytesTotal;
		
		if (percentLoaded > 1)
		{
			percentLoaded == 1;
		}
		
		graphics.clear();
		graphics.beginFill(0xFF0000, 0.5);
		graphics.drawRect(0, 0, getWidth() * percentLoaded, getHeight());
		graphics.endFill();
	}
}